# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# # 执行打包命令 fastlane uploadFir     fastlane uploadFirs
require 'net/http'
require 'uri'
require 'json'


default_platform(:android)

platform :android do
  desc "Fir测试版本ap"
  time = Time.new.strftime("%Y年%m月%d日%H时%M分")
  lane :uploadFir do
    sh("flutter", "build", "apk", "--release")
    fir_cli api_token:"d2f653948d859d2f06f88eb4d1d39e8f", specify_file_path:"../build/app/outputs/apk/release/app-universal-release.apk",need_release_id:true,dingtalk_access_token:"3a01c05738abaaeaf5c5e17d80d4cc5870410387126c5a5e2fbf0095a79977ef",dingtalk_custom_message:"钉钉群通知,App,更新android版本【安装包啦】!!",dingtalk_at_all:"true",dingtalk_at_phones:time
    puts "============================上传android测试版到Fir成功============================\n" 
  end

  desc "Submit a new Beta Build to Crashlytics Beta"
  lane :beta do
    gradle(task: "clean assembleRelease")
    crashlytics
  
    # sh "your_script.sh"
    # You can also use other beta testing services here
  end

  desc "Deploy a new version to the Google Play"
  lane :deploy do
    gradle(task: "clean assembleRelease")
    upload_to_play_store
  end
end
